home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994…tember: Reference Library / Dev.CD Sep 94.toast / Periodicals / develop / develop Issue 11 / develop 11 code / The NetWork Project / Examples (Sources) / NetSim / NetSim.p < prev    next >
Encoding:
Text File  |  1992-07-15  |  2.6 KB  |  65 lines  |  [TEXT/MPS ]

  1. {MyTemplate is a programming framework which supplies the usual Macintosh user
  2. interface. You will have to change the procedures starting with My... according 
  3. to your needs. You will find dummies for these procedures in the unit "Task".
  4. Change them there.
  5.  
  6. You will often need support by system functions. You should first look at the 
  7. functions in "StdTools". In most cases you will find a function there which is 
  8. satisfying your needs. If you do not, see Inside Macintosh.
  9.  
  10. You will rarely want to program a nongeneric response to an event. But if you 
  11. want to, the recommended procedure is: Make a copy of the Generic event handler 
  12. which you find in the unit "Generic". Paste the copy to your "TaskCtl". Rename 
  13. it to something like My... throughout TaskCtl and adopt it to your needs. An 
  14. example for this is given in "Random".
  15.  
  16. Template    main program body. In general, you will not have to change anything.
  17. tdTools        useful subroutines.You call them , but you never have to change them. 
  18. Generic        standard control functions. The TaskCtl is calling them. You rarely 
  19.             have to change them for special needs
  20. Task        Your program kernel. You have to write it. TaskCtl is calling it.
  21. TaskCtl        the main control procedures.Your rarely have to enhance them.
  22.  
  23. Comments starting MacApp are only of interest if you are migrating towards MacApp.
  24.  3.10.1987  gs    4.1 added multifinder support
  25. 30. 7.1987     gs    beta test 4.0. MacApp control structure
  26. 24. 5.1987     gs    3.1 changed naming for MacApp
  27.  1. 3.1987  gs    3.0 cleaned up }
  28.  
  29. PROGRAM MyTemplate;
  30. {© G. Sawitzki, StatLab Heidelberg 1986-1990}
  31.  
  32.     {For Lightspeed Pascal, you should include
  33.     <curly bracket>$I-<curly bracket>
  34.     to switch off the automatic initialization by Lightspeed Pascal}
  35.     
  36.     
  37. USES
  38.     MacUnits, { Standard Includes}
  39.         StdTools, Generic, 
  40.     {   use   $U<sourcefile> if unit Task is in file <sourcefile>}
  41.     NetWork,ObjIntf,SchedulerUnit,NetSimGlobal,
  42.     Task,
  43.     {   use   $U<ctlsourcefile> if unit TaskCtl is in file <ctlsourcefile>}
  44.     TaskCtl; {precompiled units used}
  45.  
  46.     CONST
  47.         TplId = 'Template 4.5';
  48.         callsToMoreMasters = 3;            {for emory management optimization}
  49.  
  50. BEGIN            {------------------Main Program-----------------}
  51.     gsInitToolbox(callsToMoreMasters); {initializes Toolbox and globals}
  52.     SetUpTheMenus;
  53.     MyInit(MyFileType);            {••• Task initialisation                •••}
  54.  
  55.     HandleFinderRequest;        {Maybe we should Print/open something,
  56.                                 because a document was selected together
  57.                                 with the application.
  58.                                 MacApp hides this inside the Run method.}
  59.     IF NOT gFinderPrinting THEN
  60.         BEGIN
  61.             DrawMenuBar;
  62.             MainEventLoop;        {••• MyTask will be called periodically •••}
  63.         END;
  64.     MyCleanUp;                    {••• Task termination                     •••}
  65. END.